<?php


namespace App\Repository1;


use Carbon\Carbon;

class OrderRepository
{
    public function getRecentOrderCount(Account $account){
        $timeStamp =Carbon::now()->subMinutes(5);
        return DB::table('orders')->where('account',$account->id)->where('created_at','>=',$timeStamp)
            ->count();
    }

    public function logOrder(Order $order) {
        DB::table('orders')->insert(
            array(
                'account' => $order->account->id,
                'amount' => $order->amount,
                'created_at' =>Carbon::now()
            )
        );
    }
}